package com.pmcc.core.web;

import com.pmcc.core.entity.Organization;
import com.pmcc.core.service.OrganizationService;
import com.pmcc.utils.AntdPage;
import com.pmcc.utils.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 * 组织机构
 * Created by tomas on 2018/4/9.
 */

@RestController()
@RequestMapping("api/v1/organizations")
public class OrganizationController {

    @Autowired
    OrganizationService organizationService;

    @GetMapping(value = "queryByPage")
    public ResultBean queryByPage(AntdPage antdPage, Organization model){
        return organizationService.queryByPage(antdPage,model);
    }

    @PostMapping(value = "addOrganization")
    public ResultBean addOrganization(@RequestBody Organization organization) {
        return organizationService.addOrganization(organization);
    }

    @PostMapping("editOrganization")
    public ResultBean editOrganization(@RequestBody Map map) {
        return organizationService.editOrganization(map);
    }

    @GetMapping("deleteOrganization")
    public ResultBean deleteOrganization(String id) {
        return organizationService.deleteOrganization(id);
    }

    @GetMapping("queryTreeGrid")
    public ResultBean queryTreeGrid() {
        return organizationService.queryTreeGrid();
    }
    //人员管理查询下拉框
    @GetMapping("queryComBo")
    public ResultBean queryComBo(){
        return organizationService.queryComBo();
    }

}

